home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Internet / TurboTCP 2.1 ƒ / PP helper classes / CTCPApplicationPP.cp next >
Encoding:
Text File  |  1995-01-19  |  1.6 KB  |  72 lines  |  [TEXT/MMCC]

  1. //
  2. // CTCPApplicationPP.cp
  3. //
  4. //    TurboTCP library
  5. //    Application mix-in class
  6. //    PowerPlant-specific class
  7. //
  8. //    Copyright © 1993-95, FrostByte Design / Eric Scouten
  9. //
  10.  
  11. #include "CTCPApplicationPP.h"
  12.  
  13. #include "UTurboTCP.h"
  14. #include "LApplication.h"
  15.  
  16. #if !TurboTCP_PP
  17.     #error: This file should be used with PowerPlant projects only!
  18. #endif
  19.  
  20.  
  21. //***********************************************************
  22.  
  23. CTCPApplicationPP::CTCPApplicationPP(LApplication* inApplication)
  24.  
  25. : LAttachment(msg_Event), mApplication(inApplication)
  26. {
  27.  
  28.     // set some default values
  29.     
  30.     mApplication->SetSleepTime(90);            // don’t want to sleep for very long
  31.                                         // ALSO, must set the “Background Null Events”
  32.                                         //    checkbox under Set Project Type…
  33.                                         //    (SIZE flags)
  34.  
  35.     mMaxTCPEvents = 0;                    // use TurboTCP’s default event count/tick count
  36.     mMaxTCPTicks = 0;                        //    as defined in UTurboTCP::ProcessNetEvents()
  37.  
  38.     // initialize TCP driver
  39.  
  40.     UTurboTCP::InitTCP();
  41.     
  42.     // arrange attachment
  43.     
  44.     mApplication->AddAttachment(this);
  45.     SetOwnerHost(mApplication);
  46.     
  47. }
  48.  
  49.  
  50. //***********************************************************
  51.  
  52. CTCPApplicationPP::~CTCPApplicationPP()
  53.  
  54. {
  55.     UTurboTCP::CloseTCP();
  56. }
  57.  
  58.  
  59. // -- event-loop tap --
  60.  
  61. //***********************************************************
  62.  
  63. void CTCPApplicationPP::ExecuteSelf(MessageT inMessage, void* ioParam)
  64.  
  65.     // Here we tap into the event loop to process TCP completions and notifications, now freed
  66.     // from interrupt-level constraints on memory management.
  67.  
  68. {
  69.     UTurboTCP::ProcessNetEvents(mMaxTCPEvents, mMaxTCPTicks, !mApplication->IsOnDuty());
  70. }
  71.  
  72.